/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author AcerII
 */
@Entity
@Table(name = "transporte")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Transporte.findAll", query = "SELECT t FROM Transporte t"),
    @NamedQuery(name = "Transporte.findById", query = "SELECT t FROM Transporte t WHERE t.id = :id"),
    @NamedQuery(name = "Transporte.findByCapacidadPeso", query = "SELECT t FROM Transporte t WHERE t.capacidadPeso = :capacidadPeso"),
    @NamedQuery(name = "Transporte.findByCapacidadVolumen", query = "SELECT t FROM Transporte t WHERE t.capacidadVolumen = :capacidadVolumen"),
    @NamedQuery(name = "Transporte.findByChapa", query = "SELECT t FROM Transporte t WHERE t.chapa = :chapa")})
public class Transporte implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Column(name = "capacidad_peso")
    private float capacidadPeso;
    @Basic(optional = false)
    @NotNull
    @Column(name = "capacidad_volumen")
    private float capacidadVolumen;
    @Size(max = 10)
    @Column(name = "chapa")
    private String chapa;
    @JoinColumn(name = "borrado_id", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Borrado borradoId;
    @OneToMany(mappedBy = "transporteId")
    private Collection<Carga> cargaCollection;

    public Transporte() {
    }

    public Transporte(Integer id) {
        this.id = id;
    }

    public Transporte(Integer id, float capacidadPeso, float capacidadVolumen) {
        this.id = id;
        this.capacidadPeso = capacidadPeso;
        this.capacidadVolumen = capacidadVolumen;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public float getCapacidadPeso() {
        return capacidadPeso;
    }

    public void setCapacidadPeso(float capacidadPeso) {
        this.capacidadPeso = capacidadPeso;
    }

    public float getCapacidadVolumen() {
        return capacidadVolumen;
    }

    public void setCapacidadVolumen(float capacidadVolumen) {
        this.capacidadVolumen = capacidadVolumen;
    }

    public String getChapa() {
        return chapa;
    }

    public void setChapa(String chapa) {
        this.chapa = chapa;
    }

    public Borrado getBorradoId() {
        return borradoId;
    }

    public void setBorradoId(Borrado borradoId) {
        this.borradoId = borradoId;
    }

    @XmlTransient
    public Collection<Carga> getCargaCollection() {
        return cargaCollection;
    }

    public void setCargaCollection(Collection<Carga> cargaCollection) {
        this.cargaCollection = cargaCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Transporte)) {
            return false;
        }
        Transporte other = (Transporte) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entidades.Transporte[ id=" + id + " ]";
    }
    
}
